import random

list_demo = [1, 22, 33, 8, 0, -1, 55, 3]


# 冒泡排序
def sort_pop(list_example):
    i = 0
    while i < len(list_example) - 1:
        j = 0
        while j < len(list_example) - i - 1:
            if list_example[j] > list_example[j + 1]:
                temp = list_example[j]
                list_example[j] = list_example[j + 1]
                list_example[j + 1] = temp
            j = j + 1
        i = i + 1
    print(list_example)


# 选择排序
def sort_select(list_example):
    i = 0
    while i < len(list_example) - 1:
        j = i
        while j < len(list_example):
            if list_example[i] > list_example[j]:
                temp = list_example[i]
                list_example[i] = list_example[j]
                list_example[j] = temp
            j = j + 1
        i = i + 1
    print(list_example)


# 质数的判断
def is_prime_number(number):
    i = 2
    temp = []
    while i <= number:
        if number % i == 0:
            temp.append(i)
        i = i + 1
    if len(temp) > 1:
        print('不是质数')
    else:
        print('是质数')
    print(temp)


def t():
    i = 2
    sum = []
    while i <= 100:
        temp = []
        j = 2
        while j <= 100:
            if i % j == 0:
                temp.append(j)
            j = j + 1
        if len(temp) == 1:
            sum.append(i)
        i = i + 1
    print(sum)


def a():
    mylist = []
    sum = 0
    avg = 0
    while True:
        a = input('请输入数字，输入quit退出 ')
        if a == 'quit':
            break
        else:
            mylist.append(a)
    print('max = ' + max(mylist))
    print('min = ' + str(mylist[0]))
    print('len = ' + str(len(mylist)))
    for i in range(len(mylist)):
        sum = sum + int(mylist[i])
    print('total = ' + str(sum))
    avg = sum / len(a)
    print('avg = ' + str(avg))


def b():
    str_total = ''
    n = 0
    s1 = 0
    other = 0
    blank = 0
    while True:
        a = input('请输入内容')
        if a == 'quit':
            break
        else:
            str_total = str_total + a
    for i in range(len(str_total)):
        s = str(str_total[i])
        if s.isdigit():
            n = n + 1
        elif s.isalnum():
            s1 = s1 + 1
        elif s.isspace():
            blank = blank + 1
        else:
            other = other + 1
    print('str_total = ' + str_total)
    print('数字有：' + str(n) + '个')
    print('字母有：' + str(s1) + '个')
    print('空格有：' + str(blank) + '个')
    print('其他字符有：' + str(other) + '个')


def c(a, b):
    str_number = str(a)
    i = 1
    str_total = ''
    while i <= b:
        str_total = str_total + '+' + str_number * i
        i = i + 1
    print(str_total[1:] + ' = ' + str(eval(str_total[1:])))


def d():
    name_a_list = ['赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', '陈', '楮', '卫', '蒋', '沈', '韩', '杨',
                   '朱', '秦', '尤', '许', '何', '吕', '施', '张', '孔', '曹', '严', '华', '金', '魏', '陶', '姜',
                   '戚', '谢', '邹', '喻', '柏', '水', '窦', '章', '云', '苏', '潘', '葛', '奚', '范', '彭', '郎',
                   '滕', '殷', '罗', '毕', '郝', '邬', '安', '常', '乐', '于', '时', '傅', '皮', '卞', '齐', '康']
    name_b_list = ['紫萱', '奕涵', '悦依', '冉莹', '芷容', '涵阳', '惜梦', '向松', '博文', '听南', '弘文', '世凯', '德辉', '泽佳', '玉露', '青玉', '怜雪',
                   '鹏轩', '平晋']
    str_a = name_a_list[random.randint(0, len(name_a_list))]
    str_b = name_b_list[random.randint(0, len(name_b_list))]
    print('孩子姓名是：' + str_a + str_b)


def e():
    letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
               'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

    error_time = 0

    while True:
        i = 0
        str_code = ''
        while i < 4:
            str_code = str_code + letters[random.randint(0, len(letters) - 1)]
            i = i + 1
        # 避免出现全是数字或者全是字母的情况
        if str_code.isdigit() or str_code.isalpha():
            str_code = ''
            while i < 4:
                str_code = str_code + letters[random.randint(0, len(letters) - 1)]
                i = i + 1
        else:
            break

    print('str_code = ' + str_code)
    while True:
        if input('请输入正确的验证码  ') == str_code:
            print('输入正确程序结束')
            break
        else:
            error_time = error_time + 1
            print('验证码输入不正确, 还剩' + str(3 - error_time) + '机会')
            if error_time == 3:
                print('验证码失败次数以到3次,请输入新的验证码')
                e()
                break


# sort_pop(list_demo)
# sort_select(list_demo)

# is_prime_number(int(input('请输入一个数')))
# t()
# a()
# b()
# c(3, 7)
# d()
# e()
print('e'>'c')
